PIC24F
I/O Ports Library Help


Table Of Contents

1     Library Features. 3

2     Using Library Functions in Your Code. 3

3     Functions. 3

3.1     CloseINTX (X = 0 … 4 ) 3

3.2     ConfigINTX (X = 0 … 4 ) 4

3.3     ConfigCNPullups. 4

3.4     ConfigIntCN.. 4

4     Macros. 5

4.1     EnableCNX (X = 0 to 21) 5

4.2     DisableCNX (X = 0 to 21) 5

4.3     DisableINTX (X = 0 to 4) 5

4.4     EnableINTX (X = 0 to 4) 6

4.5     SetPriorityIntX (X = 0 to 4) 6

 


1          Library Features

 

For this peripheral library:

 

·         A parallel I/O port that shares a pin with a peripheral is, in general, subservient to the peripheral.

·         When a peripheral is enabled and the peripheral is actively driving an associated pin, the use of the pin as a general purpose output pin is disabled.

 

2          Using Library Functions in Your Code

 

Library routine parameters can be constructed using either AND based mask or AND_OR based mask setting. For more information on these masks, see 16-bit Peripheral Libraries.

 

Examples of use for both the methods are below.

 

Example of Use ( AND mask )

 

CloseINT0(EXT_INT_PRI_3 & EXT_INT_ENABL & RISING_EDGE_INT);

 

Example of Use ( AND_OR mask )

 

#define USE_AND_OR        /* To enable AND_OR mask setting */

#include<ports.h>

   /*

    …

    User code

    …

   */

   CloseINT0(EXT_INT_PRI_3 | EXT_INT_ENABL | RISING_EDGE_INT);

 

   /*

    …

    User code

    …

   */

 

3          Functions

3.1         CloseINTX (X = 0 … 4 )

 

Function Prototype

void CloseINT0(void);

void CloseINT1(void);

void CloseINT2(void);

void CloseINT3(void);

void CloseINT4(void);

Include

ports.h

Description

This function disables the external interrupt on INT pin.

Arguments

None

Return Value

None

Remarks:

This function disables the interrupt on INT pin and clears the corresponding Interrupt flag.

Source File:

CloseInt0.c

CloseInt1.c

CloseInt2.c

CloseInt3.c

CloseInt4.c

3.2         ConfigINTX (X = 0 … 4 )

 

Function Prototype

void ConfigINT0(unsigned int config);

void ConfigINT1(unsigned int config);

void ConfigINT2(unsigned int config);

void ConfigINT3(unsigned int config);

void ConfigINT4(unsigned int config);

Include

ports.h

Description

This function disables the external interrupt on INT pin.

Arguments

config - Interrupt edge, priority and enable/disable information as defined below:

Interrupt edge selection

   RISING_EDGE_INT

   FALLING_EDGE_INT

Interrupt enable

   INT_ENABLE

   INT_DISABLE

Interrupt priority

   INT_PRI_0

   INT_PRI_1

   INT_PRI_2

   INT_PRI_3

   INT_PRI_4

   INT_PRI_5

   INT_PRI_6

   INT_PRI_7

Return Value

None

Remarks:

This function clears the interrupt flag corresponding to the INTx pin and then selects the edge detect polarity.

It then sets the interrupt priority and enables/disables the interrupt.

Source File:

ConfigInt0.c

ConfigInt1.c

ConfigInt2.c

ConfigInt3.c

ConfigInt4.c

3.3         ConfigCNPullups

 

Function Prototype

void ConfigCNPullups(long int config);

Include

ports.h

Description

This function configures the pull-up resistors for CN pins.

Arguments

config - This is the 32-bit value for configuring pull-ups. The lower word is stored into CNPU1 register and next upper word is stored into CNPU2 register. The upper 10 bits of CNPU2 register are unimplemented.

Return Value

None

Remarks:

This function disables the interrupt on INT pin and clears the corresponding Interrupt flag.

Source File:

ConfigCNPullups.c

3.4         ConfigIntCN

 

Function Prototype

void ConfigIntCN(long int config);

Include

ports.h

Description

This function configures the CN interrupts.

Arguments

config - This is the 32-bit value for configuring the CN interrupts.

The lower 22 bits contain the individual enable/disable information for the CN interrupts. Setting bit x (x = 0, 1, ...,21) would enable the CNx interrupt.

The upper-most byte contains the Interrupt Priority and Enable/Disable bits.

The lower word is stored into the CNEN1register and next upper byte is stored into the CNEN2 register and the upper most byte is used for setting priority and enable/disable the CN interrupts.

Return Value

None

Remarks:

This function clears the CN interrupt flag and enables/disables the individual interrupts on CN pins.

This also configures the interrupt priority and enables/disables the CN Interrupt Enable bit.

Source File:

ConfigIntCN.c

 

4          Macros

4.1         EnableCNX (X = 0 to 21)

 

Macro

EnableCN0

EnableCN1

EnableCN2

....

EnableCN21

Include

ports.h

Description

This macro enables the individual change notification interrupt.

Arguments

None

Remarks

None

4.2         DisableCNX (X = 0 to 21)

 

Macro

DisableCN0

DisableCN1

DisableCN2

....

DisableCN21

Include

ports.h

Description

This macro disables individual change notification interrupt.

Arguments

None

Remarks

None

4.3         DisableINTX (X = 0 to 4)

Macro

DisableINT0

DisableINT1

DisableINT2

DisableINT3

DisableINT4

Include

ports.h

Description

This macro disables the individual external interrupt.

Arguments

None

Remarks

None

4.4         EnableINTX (X = 0 to 4)

 

Macro

EnableINT0

EnableINT1

EnableINT2

EnableINT3

EnableINT4

Include

ports.h

Description

This macro enables the individual external interrupt.

Arguments

None

Remarks

None

4.5         SetPriorityIntX (X = 0 to 4)

 

Macro

SetPriorityInt0

SetPriorityInt1

SetPriorityInt2

SetPriorityInt3

SetPriorityInt4

Include

ports.h

Description

This macro sets priority for external interrupts.

Arguments

priority

Remarks

This macro sets External Interrupt Priority bits of Interrupt Priority Control register.